{% extends 'starter.html' %}

{% block title %}
    <h1>
        {#        {% if tag  == 1 %}#}
        {#            客户展示#}
        {#            <small>Optional description</small>#}
        {#            {% else %}#}
        {#            我的客户#}
        {#            <small>Optional description</small>#}
        {#        {% endif %}#}
        {% load mytags %}
        {% tag request %}
    </h1>
{% endblock %}


{% block content %}
    <a href="{% url 'add_customer' %}" class="btn btn-primary">添加客户</a>
    <div class="form-group">
        <form class="form-inline" action="{{ current_request_path }}">
            <div class="form-group pull-right">
                <select name="search_field" id="search_field" class="form-control">
                    <option value="qq__contains" {% if search_field == 'qq__contains' %} selected {% endif %}>qq
                    </option>
                    <option value="name__contains" {% if search_field == 'name__contains' %} selected {% endif %}>name
                    </option>
                </select>
                <label for="key_word"></label>
                <input type="text" class="form-control" id="key_word" placeholder="请输入搜素内容" name="kw" value="{{ kw }}">
                <button type="submit" class="btn btn-default">搜索</button>
            </div>
        </form>
        <form class="form-inline" action="" method="post">
            <select name="action" id="action" class="form-control">
                {% if tag  == 1 %}
                    <option value="reverse_gs">公户转私户</option>
                {% else %}
                    <option value="reverse_sg">私户转公户</option>
                {% endif %}


            </select>
            <button class="btn btn-warning">go</button>

            <table class="table table-striped table-hover table-bordered">
                <thead>
                <tr>
                    <th>
                        <input type="checkbox" id="select_all">操作
                    </th>
                    <th>序号</th>
                    <th>id</th>
                    <th>QQ</th>
                    <th>QQ昵称</th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>生日</th>
                    <th>客户来源</th>
                    <th>转自介绍学员</th>
                    <th>跟进记录</th>
                    <th>销售</th>
                    <th>报名状态</th>
                    <th>编辑</th>
                </tr>
                </thead>
                <tbody>
                {% for customer in customer_obj %}
                    <tr>
                        <td>
                            <input type="checkbox" name="cids" value="{{ customer.pk }}">
                        </td>
                        <td>{{ forloop.counter }}</td>
                        <td>{{ customer.pk }}</td>
                        <td>{{ customer.qq }}</td>
                        <td>{{ customer.qq_name }}</td>
                        <td>{{ customer.name }}</td>
                        <td>{{ customer.get_sex_display }}</td>
                        <td>{{ customer.birthday | date:"Y-m-d" }}</td>
                        <td>{{ customer.source }}</td>
                        <td>{{ customer.introduce_from }}</td>

                        <td>
                            <a href="{% url 'consult_record' %}?cid={{ customer.pk }}">查看详情</a>
                        </td>
                        <td>{{ customer.consultant|default:'暂无' }}</td>
                        <td>{{ customer.status_show }}</td>
                        <td>
                            <a href="{% url 'edit_customer' customer.pk %}?next={{ request.get_full_path }}"><i
                                    class="fa fa-edit"></i></a>
                            {#                    {% load mytags %}#}
                            {#                    <a href="{% resole_url request 'edit_customer' customer.pk %}"><i class="fa fa-edit"></i></a>#}
                        </td>
                    </tr>
                {% endfor %}

                </tbody>
            </table>
            {{ page_html | safe }}
        </form>
    </div>

    {#    <nav aria-label="Page navigation">#}
    {#        <ul class="pagination">#}
    {#            <li>#}
    {#                <a href="#" aria-label="Previous">#}
    {#                    <span aria-hidden="true">&laquo;</span>#}
    {#                </a>#}
    {#            </li>#}
    {#            {% for p in page_num_count %}#}
    {#                <li><a href="/customers/?page={{ p }}">{{ p }}</a></li>#}
    {#            {% endfor %}#}
    {##}
    {##}
    {#            <li>#}
    {#                <a href="#" aria-label="Next">#}
    {#                    <span aria-hidden="true">&raquo;</span>#}
    {#                </a>#}
    {#            </li>#}
    {#        </ul>#}
    {#    </nav>#}


{% endblock content %}